1. Field of Invention
This invention generally relates to determining an amount of skew or distortion in an electronic image.
2. Description of Related Art
Paper documents that are scanned by a scanner, copier or other device are often misaligned, or skewed, with respect to the imaging device. Thus, the resulting electronic image is skewed. For example, FIG. 1 shows an electronic image that has the text information skewed with respect to the image borders. That is, the text lines in the electronic image are not parallel to the top and bottom borders of the electronic image.
Skew in an electronic image is a problem because if the electronic image is printed or displayed without correction, the printed or displayed image will include the skew present in the electronic image.
Several methods have been proposed for determining the amount of skew, or skew angle, in electronic images. One such method represents each text character in an image by a point and projects all of the points in a number of pre-computed directions. The direction in which the maximum number of points are colinear with a family of parallel lines is considered the direction of the text lines. The angular difference between the direction of the text lines and the horizontal axis is the skew of the image. For example, FIG. 2 shows a graphic representation of such a skew evaluation of the image in FIG. 1. As shown in FIG. 2, a maximum number of text character points are colinear when projected at an angle xcex8. Thus, the skew of the electronic image is determined to be xcex8.
Other methods for determining the skew in a document image have been proposed. These methods statistically estimate the character width, intercharacter gaps, interword gaps, etc. and use the values to determine skew. While these methods may be effective for determining skew in images including lines of text, the methods are not effective when used with other image types, such as images of engineering drawings, like that shown in FIG. 3, which include few characters, words or word gaps that can be used to determine skew. Thus, the proposed methods for determining skew cannot accurately determine skew in the FIG. 3 image.
The invention provides a method and apparatus for determining skew in an electronic image that are effective for determining skew in document images including engineering drawings.
The invention provides a method for determining skew in an electronic image whereby portions of the image are sampled, and connected components are generated from the sampled portions. The connected components are then projected, and the skew of the image is determined based on the projected components.
In one aspect of the invention, a skew is determined based on the direction in which a maximum number of projected connected components in the image extend.
In one aspect of the invention, portions of an image are sampled using sampling windows that extend substantially across the image in a first direction, but do not extend substantially across the image in a second direction transverse to the first direction.
In one aspect of the invention, portions of the image are sampled using sampling windows that are transverse to each other.
In one aspect of the invention, the sampling windows extend substantially further across an image in a first direction than in a second direction transverse to the first direction.
In one aspect of the invention, connected components that extend in a first direction are generated using image data samples from sampling windows oriented transverse to the first direction.
In one aspect of the invention, a skew direction is determined based on a squared sum of projected components for each of a plurality of directions.
In one aspect of the invention, a skew is determined for at least two transverse directions in the image.
In one aspect of the invention, skew information is used to make image warp corrections to the image.
In one aspect of the invention, a skew is determined for different image regions within the image and used to correct the image.
The invention also provides an image processing device, such as a copier, that comprises an image data input device that inputs image data representing an image. A connected component generator samples the image data, and generates connected components. An image skew analyzer determines a skew of the image from the directions of projected connected components.
In one aspect of the invention, an image adjuster adjusts the image data based on the determined image skew.
In one aspect of the invention, the image processing device outputs an image based on image data adjusted based on a determined image skew.